package com.catazy.module_project.repository

import com.catazy.module_project.bean.ArticleData
import com.catazy.module_project.bean.ProjectBean
import com.catazy.module_project.net.HttpProjectService
import com.catazy.wanandroid.common_base.bean.HttpResult
import dagger.hilt.android.scopes.ActivityRetainedScoped
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import javax.inject.Inject

/**
 * 作者: Tao
 * 日期: 2024/5/7
 * 时间: 9:58
 * 描述: 项目远程仓库
 */
@ActivityRetainedScoped
class ProjectRemoteRepository @Inject constructor() {

    /**
     * 获取项目树
     */
    fun getProjectTree(): Flow<HttpResult<List<ProjectBean>>> {
        return HttpProjectService.service.getProjectTree()
    }

    /**
     * 获取项目列表
     */
     fun getProjectList(id: Int, page: Int): Flow<HttpResult<ArticleData>> {
        return HttpProjectService.service.getProjectList(page, id)
    }
}